<!--#include file="header.htm" -->
<div id="content">

<h1>Cookies</h1>

<p>Cookies are small text strings that are stored in the browser.  These strings
are set by the server, and returned as parameters for all future requests until
the session ends.  They can be used to store session state information, and are
valid until the browser is closed.</p>

<div class="examplebox">
<table align="center">
<tr><td><b>Name:</b></td><td>~cookiename~</td></tr>
<tr><td><b>Favorite:</b></td><td>~cookiefav~</td></tr>
</table>
</div>

<p>There are numerous uses for cookies.  In this example, the user's name is
stored as a cookie.  All future page loads will show this name in the top left
corner, as well as in the box above.</p>

<form action="cookies.htm" method="get">
<div class="examplebox">
<table align="center">
<tr><td><b>First Name:</b></td><td><input type="text" name="name" size="20" maxlength="16" /></td></tr>
<tr><td><b>Favorite:</b></td><td><select name="fav"><option value="PIC32">PIC32</option></select></td></tr>
<tr><td></td><td><input type="submit" value="Set Cookies" /></td></tr>
</table>
</div>
</form>

<p>Cookies are set by storing null-terminated name/value pairs in the current HTTP connection
data buffer. The number of cookies that are set is also stored.
They can be set in either <code>getExecute</code> or <code>postExecute</code>.</p>

<p>Cookies are retrieved in the same manner as GET form arguments.  They are stored
in the current HTTP connection data buffer and can be located using the <code>TCPIP_HTTP_NET_ArgGet</code>
functions.  Since they are stored in the same array as GET arguments, the total
length of cookies and variable arguments cannot exceed the 80 byte buffer limit.</p>

<p class="exercise"><b>Exercise:</b> Set a second cookie named <code>fav</code> with the
value of the <code>favorite</code> field and have it displayed in the gray box above.</p>

</div>

<script type="text/javascript">
<!--
document.getElementById('hello').innerHTML = "~hellomsg~";
-->
</script>
<!--#include file="footer.htm" -->
